module.exports = class extends think.Model {
  /**
     *
     * @param {*int} id
     * @param {*Object} data
     */
  async updateById(id, data) {
    return this.where({id}).update(data);
  }
  async removeById(id) {
    return this.where({
      id
    }).update({
      is_deleted: global.IS_DELETED.yes
    });
  }
  async queryData({page = 1, limit = 10, field = '*', title = ''}) {
    const where = {
      is_deleted: global.IS_DELETED.no
    };
    if (title) {
      where.title = title;
    }
    return this.where(where).page(page, limit).field(field).select();
  }
};
